<!-- 活动断层-线 -->
<template>
  <el-drawer v-model="addDrawer" size="48%" :show-close="false" @opened="openDrawer" @close="closeDrawer">
    <template #title>
      <el-space direction="vertical" class="space-width100">
        <div v-if="route.path.includes('dataIntegrate') && form.qcOpinion">
          <el-form :model="form" :inline="true" label-width="140px">
            <el-form-item label="质检不通过原因" style="width: 100%">
              <el-input v-model="form.qcOpinion" type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" resize="none"
                clearable></el-input>
            </el-form-item>
          </el-form>
        </div>
        <h2>
          <el-row justify="space-between">
            <span><svg-icon icon-class="list"></svg-icon><span style="padding-left: 15px">{{ typeName }}</span></span>
            <el-button type="primary" @click="confirmClick" :disabled="drawerLoading" v-if="isShowSave">保存</el-button>
          </el-row>
        </h2>
      </el-space>
    </template>
    <template #default>
      <el-form :model="form" ref="addRef" :inline="true" :rules="formRules" label-width="160px" v-loading="drawerLoading">
        <el-row justify="space-between">
          <el-form-item label="省">
            <el-input v-model="form.province" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="市">
            <el-input v-model="form.city" clearable disabled></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="区/县">
            <el-input v-model="form.county" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="断层编号" prop="id">
            <el-input v-model="form.id" placeholder="请输入断层编号" clearable maxlength="17"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="工作底图比例尺（分母）" prop="scale">
            <el-input v-model="form.scale" placeholder="请输入工作底图比例尺（分母）" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="断裂带名称" prop="fractureZoneName" style="width: 100%">
            <el-input v-model="form.fractureZoneName" placeholder="请输入地貌点名称" :autosize="{ minRows: 2, maxRows: 4 }"
              type="textarea" show-word-limit maxlength="40" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="断层名称" prop="name" style="width: 100%">
            <el-input v-model="form.name" placeholder="请输入断层名称" clearable :autosize="{ minRows: 2, maxRows: 4 }"
              type="textarea" show-word-limit maxlength="40" resize="none"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="断层段名称" prop="faultSegmentName" style="width: 100%">
            <el-input v-model="form.faultSegmentName" placeholder="请输入断层段名称" clearable
              :autosize="{ minRows: 2, maxRows: 4 }" type="textarea" show-word-limit maxlength="40"
              resize="none"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="走向 [16方位]" prop="strikeDirection">
            <dict-select code="CVD-16-Direction" :value="form.strikeDirection"
              @update="updateDict('strikeDirection', $event)"></dict-select>
          </el-form-item>
          <el-form-item label="断层走向 [度]" prop="strike">
            <el-input v-model.number="form.strike" placeholder="请选择断层走向 [度]" clearable maxlength="4" />
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="倾向 [16方位]" prop="direction">
            <dict-select code="CVD-16-Direction" :value="form.direction"
              @update="updateDict('direction', $event)"></dict-select>
          </el-form-item>
          <el-form-item label="倾角 [度]" prop="clination">
            <el-input v-model.number="form.clination" placeholder="请输入倾角 [度]" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="长度 [公里]" prop="length">
            <el-input v-model="form.length" placeholder="请输入长度 [公里]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="上断点埋深 [米]" prop="topDepth">
            <el-input v-model.number="form.topDepth" placeholder="请输入上断点埋深 [米]" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="破碎带宽度 [米]" prop="width">
            <el-input v-model="form.width" placeholder="请输入破碎带宽度 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="变形带宽度 [米]" prop="fractureBeltWidth">
            <el-input v-model="form.fractureBeltWidth" placeholder="请输入变形带宽度 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="断层性质" prop="feature">
            <dict-select code="FaultTypeCVD" :value="form.feature" @update="updateDict('feature', $event)"></dict-select>
          </el-form-item>
          <el-form-item label="最新活动时代" prop="latestActivePeriod">
            <dict-select code="AgeCVD" :value="form.latestActivePeriod"
              @update="updateDict('latestActivePeriod', $event)"></dict-select>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="位移与平均速率起算时间" prop="startTimeEst" style="width: 100%">
            <el-input v-model="form.startTimeEst" placeholder="请输入位移与平均速率起算时间" clearable
              :autosize="{ minRows: 2, maxRows: 4 }" type="textarea" show-word-limit maxlength="50"
              resize="none"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="垂直位移 [米]" prop="vdisplaceEst">
            <el-input v-model="form.vdisplaceEst" placeholder="请输入垂直位移 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="误差" prop="vdisplaceEr">
            <el-input v-model="form.vdisplaceEr" placeholder="请输入误差" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="走向水平位移 [米]" prop="hdisplaceEst">
            <el-input v-model="form.hdisplaceEst" placeholder="请输入走向水平位移 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="误差" prop="hdisplaceEr">
            <el-input v-model="form.hdisplaceEr" placeholder="请输入误差" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="水平//张缩位移 [米]" prop="tdisplaceEst">
            <el-input v-model="form.tdisplaceEst" placeholder="请输入水平//张缩位移 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="误差" prop="tdisplaceEr">
            <el-input v-model="form.tdisplaceEr" placeholder="请输入误差" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="平均垂直速率 [毫米/年]" prop="aveVrate">
            <el-input v-model="form.aveVrate" placeholder="请输入平均垂直速率 [毫米/年]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="误差" prop="aveVrateEr">
            <el-input v-model="form.aveVrateEr" placeholder="请输入误差" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="平均水平速率 [毫米/年]" prop="aveHrate">
            <el-input v-model="form.aveHrate" placeholder="请输入平均水平速率 [毫米/年]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="误差" prop="aveHrateEr">
            <el-input v-model="form.aveHrateEr" placeholder="请输入误差" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="最新速率起算时间" prop="startTimeNewest">
            <el-input v-model="form.startTimeNewest" placeholder="请输入最新速率起算时间" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="最新垂直速率 [毫米/年]" prop="newVrate">
            <el-input v-model="form.newVrate" placeholder="请输入最新垂直速率 [毫米/年]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="误差" prop="newVrateEr">
            <el-input v-model="form.newVrateEr" placeholder="请输入误差" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="最新水平速率 [毫米/年]" prop="newHrate">
            <el-input v-model="form.newHrate" placeholder="请输入最新水平速率 [毫米/年]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="误差" prop="newHrateEr">
            <el-input v-model="form.newHrateEr" placeholder="请输入误差" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="最大垂直速率 [米]" prop="maxVrate">
            <el-input v-model="form.maxVrate" placeholder="请输入最大垂直速率 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="误差" prop="maxVrateEr">
            <el-input v-model="form.maxVrateEr" placeholder="请输入误差" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="最大水平速率 [毫米/年]" prop="maxHrate">
            <el-input v-model="form.maxHrate" placeholder="请输入最大水平速率 [毫米/年]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="误差" prop="maxHrateEr">
            <el-input v-model="form.maxHrateEr" placeholder="请输入误差" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="古地震事件次数" prop="eqEventCount">
            <el-input v-model="form.eqEventCount" placeholder="请输入古地震事件次数" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="古地震复发间隔" prop="eqEventRibottom">
            <el-input v-model="form.eqEventRibottom" placeholder="请输入古地震复发间隔" clearable maxlength="4"></el-input>
          </el-form-item>
          <el-form-item label="古地震复发间隔上限" prop="eqEventRitop">
            <el-input v-model="form.eqEventRitop" placeholder="请输入古地震复发间隔上限" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="确定手段" prop="method">
            <el-input v-model="form.method" placeholder="请输入确定手段" clearable maxlength="4"></el-input>
          </el-form-item>
          <el-form-item label="最大破裂长度" prop="maxRuptureLength">
            <el-input v-model.number="form.maxRuptureLength" placeholder="请输入最大破裂长度" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="平均破裂长度" prop="averageRuptureLength">
            <el-input v-model.number="form.averageRuptureLength" placeholder="请输入平均破裂长度" clearable
              maxlength="4"></el-input>
          </el-form-item>
          <el-form-item label="最晚地震离逝时间" prop="elapseTimeForLatestEq">
            <el-input v-model="form.elapseTimeForLatestEq" placeholder="请输入最晚地震离逝时间" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="错动深度" prop="slipDepthEst">
            <el-input v-model.number="form.slipDepthEst" placeholder="请输入错动深度" clearable maxlength="4"></el-input>
          </el-form-item>
          <el-form-item label="错动深度误差" prop="slipDepthEr">
            <el-input v-model="form.slipDepthEr" placeholder="请输入错动深度误差" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="平均滑动速率 [毫米/年]" prop="averageSlipRateEst">
            <el-input v-model.number="form.averageSlipRateEst" placeholder="请输入平均滑动速率 [毫米/年]" clearable
              maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="平均滑动速率误差" prop="averageSlipRateEr">
            <el-input v-model="form.averageSlipRateEr" placeholder="请输入平均滑动速率误差" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="蠕动速率 [毫米/年]" prop="creepRateEst">
            <el-input v-model.number="form.creepRateEst" placeholder="请输入蠕动速率 [毫米/年]" clearable maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="蠕动速率误差" prop="creepRateEr">
            <el-input v-model="form.creepRateEr" placeholder="请输入蠕动速率误差" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="最大同震位移 [米]" prop="coSeismicMaxSlipEst">
            <el-input v-model.number="form.coSeismicMaxSlipEst" placeholder="请输入最大同震位移 [米]" clearable
              maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="最大同震位移误差" prop="coSeismicMaxSlipEr">
            <el-input v-model="form.coSeismicMaxSlipEr" placeholder="请输入最大同震位移误差" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="平均同震位移 [米]" prop="coSeismicAverageSlipEst">
            <el-input v-model.number="form.coSeismicAverageSlipEst" placeholder="请输入平均同震位移 [米]" clearable
              maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="平均同震位移误差" prop="coSeismicAverageSlipEr">
            <el-input v-model="form.coSeismicAverageSlipEr" placeholder="请输入平均同震位移误差" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="最新地震平均位移" prop="latestCoSeismicSlipEst">
            <el-input v-model.number="form.latestCoSeismicSlipEst" placeholder="请输入最新地震平均位移" clearable
              maxlength="8"></el-input>
          </el-form-item>
          <el-form-item label="最新地震平均位移误差" prop="latestCoSeismicSlipEr">
            <el-input v-model="form.latestCoSeismicSlipEr" placeholder="请输入最新地震平均位移误差" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="断层符号基础位" prop="nsb1">
            <el-input v-model.number="form.nsb1" placeholder="请输入断层符号基础位" clearable maxlength="10"></el-input>
          </el-form-item>
          <el-form-item label="断层符号下标位" prop="nsb2">
            <el-input v-model.number="form.nsb2" placeholder="请输入断层符号下标位" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="断层符号上标位" prop="nsb3">
            <el-input v-model.number="form.nsb3" placeholder="请输入断层符号上标位" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="断层显示码" prop="showCode">
            <el-input v-model="form.showCode" placeholder="请输入断层显示码" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="备注" prop="commentInfo" style="width:100%">
            <el-input v-model="form.commentInfo" placeholder="请输入备注" :autosize="{ minRows: 6, maxRows: 12 }"
              type="textarea" show-word-limit maxlength="2147483647" clearable></el-input>
          </el-form-item>
        </el-row>
      </el-form>
    </template>
  </el-drawer>
</template>
<script setup>
import useSpatialData from '@/hooks/useSpatialData'
import { rangeValidate, eightDouble, fourInt } from '@/utils/validate'
const { route, addDrawer, drawerLoading, form, typeName, openDrawer, closeDrawer, confirmClick, updateDict, isShowSave } = useSpatialData()
const formRules = {
  id: [{ required: true, message: '请填写断层编号！', trigger: 'blur' }],
  name: [{ required: true, message: '请填写断层名称！', trigger: 'blur' }],
  strike: [{ type: 'number', message: '请输入整数' }, { min: 0, max: 359, validator: rangeValidate }],
  clination: [{ type: 'number', message: '请输入整数' }, { min: 0, max: 90, validator: rangeValidate }],
  length: [eightDouble],
  topDepth: [eightDouble],
  width: [eightDouble],
  fractureBeltWidth: [eightDouble],
  vdisplaceEst: [eightDouble],
  vdisplaceEr: [eightDouble],
  hdisplaceEst: [eightDouble],
  hdisplaceEr: [eightDouble],
  tdisplaceEst: [eightDouble],
  tdisplaceEr: [eightDouble],
  aveVrate: [eightDouble],
  aveVrateEr: [eightDouble],
  aveHrate: [eightDouble],
  aveHrateEr: [eightDouble],
  startTimeNewest: [eightDouble],
  newVrate: [eightDouble],
  newVrateEr: [eightDouble],
  newHrate: [eightDouble],
  newHrateEr: [eightDouble],
  maxVrate: [eightDouble],
  maxVrateEr: [eightDouble],
  maxHrate: [eightDouble],
  maxHrateEr: [eightDouble],
  eqEventCount: [fourInt],
  eqEventRibottom: [fourInt],
  eqEventRitop: [fourInt],
  method: [fourInt],
  maxRuptureLength: [fourInt],
  averageRuptureLength: [fourInt],
  elapseTimeForLatestEq: [fourInt],
  slipDepthEst: [fourInt],
  slipDepthEr: [fourInt],
  averageSlipRateEst: [eightDouble],
  averageSlipRateEr: [eightDouble],
  creepRateEst: [eightDouble],
  creepRateEr: [eightDouble],
  coSeismicMaxSlipEst: [eightDouble],
  coSeismicMaxSlipEr: [eightDouble],
  coSeismicAverageSlipEst: [eightDouble],
  coSeismicAverageSlipEr: [eightDouble],
  latestCoSeismicSlipEst: [eightDouble],
  latestCoSeismicSlipEr: [eightDouble],
  nbs2: [fourInt],
  nbs3: [fourInt],
  showCode: [fourInt]
}
</script>
<style scoped></style>